Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch manual validation to automatic #28

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

njr-11
Copy link
Contributor

@njr-11 njr-11 commented Nov 28, 2023

The sample is manually requesting validation. It could instead annotate the parameter to save and get the Jakarta Data provider to automatically request it.

Signed-off-by: Nathan Rauh <nathan.rauh@us.ibm.com>
@njr-11 njr-11 self-assigned this Nov 28, 2023
Copy link
Member

@mswatosh mswatosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

JsonArrayBuilder messages = Json.createArrayBuilder();
for (ConstraintViolation<CrewMember> v : violations) {
for (ConstraintViolation<?> v : x.getConstraintViolations()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had tried this before, but I was missing this piece. I didn't realize we could get the violations out of the exception, so we can still return them to the UI

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think I was validating at the REST layer, instead of with jakarta data.

@mswatosh mswatosh merged commit a72067c into main Nov 28, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants